package net.cyndeline.rlgraph.orthogonal.representation.help

/**
 * Wraps a vertex from a graph. Used as vertices for Darts when computing orthogonal representations, since
 * removing edge bends and adding dummy vertices during rectangularization sometimes requires extra vertices
 * that doesn't have an equivalent in the original graph.
 *
 * @param value Vertex to wrap.
 */
class VertexWrapper[VType](val value: Option[VType]) {
  val str = if (value.isDefined) value.get.toString else "{dummy_wrapper " + {
    val hash = Math.abs(hashCode).toString
    hash.drop(hash.size - 4)
  } + "}"

  def this() = this(None)
  def this(v: VType) = this(Option(v))

  def isDefined: Boolean = value.isDefined

  override def toString: String = str
}
